package star.cloud.asme.person.ndePersonCertification;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import jakarta.persistence.Entity;
import jakarta.persistence.Transient;
import lombok.*;
import star.cloud.asme.base.mybatis.IBaseEntity;
import star.cloud.asme.system.user.User;

import java.time.LocalDate;

@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Entity(name = "senpec_person_nde_certification")
@TableName("senpec_person_nde_certification")
public class NdePersonCertification extends IBaseEntity<NdePersonCertification> {
    private String name;
    private String username;
    private String workNo;
    private String domain;//证书领域
    private String reference;//证书编号
    private String method;
    private Integer level;
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate startDate;
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate endDate;
    private Boolean isLatest;
    private String attachmentUuid;
    @Transient
    @TableField(exist = false)
    private String attachmentUrl;
    @Transient
    @TableField(exist = false)
    private Boolean isValid;
    @Transient
    @TableField(exist = false)
    private User user;
    //初次取得无损证书日期
    @Transient
    @TableField(exist = false)
    private LocalDate initNdeDate;
    //初次取得该方法证书日期
    @Transient
    @TableField(exist = false)
    private LocalDate initMethodDate;
    //初次取得该方法领域证书日期
    @Transient
    @TableField(exist = false)
    private LocalDate initMethodDomainDate;
    //初次取得该方法领域等级证书日期
    @Transient
    @TableField(exist = false)
    private LocalDate initMethodDomainLevelDate;
}
